<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // typof 不能精确的判断类型；可以精确判断 简单的数据类型 ，不能精确判断复杂数据类型；

        // let a = "fdafd";
        // var b = 231;
        // var c = null;
        // var d = undefined ;
        // var e = true;
        // var f = Symbol();
        // console.log(typeof a)
        // console.log(typeof b)
        // console.log(typeof c)
        // console.log(typeof d)
        // console.log(typeof e)
        // console.log(typeof f);


        let a = {};
        let b = [];
        let c = function () { };
        let e = /\d/;
        let f = new Date();

        // console.log(typeof a)
        // console.log(typeof b)
        // console.log(typeof c)
        // console.log(typeof e)
        // console.log(typeof f);
        // 精确判断复杂数据类型；Object.prototype.toString.call(数据);
        console.log(Object.prototype.toString.call("123"));
        console.log(Object.prototype.toString.call(true));
        console.log(Object.prototype.toString.call(undefined));
        console.log(Object.prototype.toString.call(null));
        console.log(Object.prototype.toString.call(333));
        console.log(Object.prototype.toString.call(Symbol()));
        console.log(Object.prototype.toString.call(a));
        console.log(Object.prototype.toString.call(b));
        console.log(Object.prototype.toString.call(c));
        console.log(Object.prototype.toString.call(e));
        console.log(Object.prototype.toString.call(f));
        if (Object.prototype.toString.call(e) == "[object RegExp]") {
            console.log("是一个正则表达式");
        } else {
            console.log("不是一个正则表达式");
        }
    </script>
</body>

</html>